Once an active context is set up and entry by other processes is allowed, other processes can call acattach (without the AC_CREATE flag) to attach to the active context. For example:
fd = acattach("/tmp/.D11-ctx:0", 0, /*ignored*/ 0, /*ignored*/ 0);Attaching to an active context creates an ``alternate personality'' process (with a slot in the system process table). This alternate personality process (APP) exists as a standard Unix process and is a child of the active context creator ( not the process attaching to the active context). An APP inherits file descriptors, signal handlers, the effective uid, and other Unix process attributes from the active context creator. In many ways, the APPs associated with an active context are similar to IRIX process share groups [3,24] to the extent that they share Unix system resources with one another in a way consistent with expected Unix operating system semantics.
A process attached to an active context can initiate a protected procedure call to ``switch personalities'' to the process's APP by calling:
status = acppcall(fd, op, ...);The result of acppcall is that the calling process is suspended and execution is handed off to the process's APP which begins execution at the active context entry point. The entry point is called with the following parameters:
entry_func(app_id, op, ...);The app_id is a small unsigned integer indicating what APP is running. The entry_func uses this parameter to determine the identity of the APP within the active context. The op parameter is an integer indicating the operation to perform.
An APP returns from a protected procedure call by calling:
acreturn(status);Returning from a protected procedure call suspends the APP and resumes the process initiating the protected procedure call. status is an unsigned integer returned as the successful return value of acppcall.
Multiple APPs can enter the active context simultaneously, so shared synchronization mechanisms within the active context should be used to coordinate execution within the active context.